package wicketcool.model;

import wicketcool.model.method.WCLMethod;
import wicketcool.model.types.WCLGenericType;
import wicketcool.model.types.WCLInterfaceType;

import java.util.ArrayList;
import java.util.List;

/**
 * User: rabbit
 * Date: Aug 6, 2009
 */
public class WCLInterface {

    private final String name;
    private final String packageName;

    private final List<WCLGenericType> genericTypes = new ArrayList<WCLGenericType>();
    private final List<WCLImport> imports = new ArrayList<WCLImport>();
    private final List<WCLAnnotation> annotations = new ArrayList<WCLAnnotation>();
    private final List<WCLField> fields = new ArrayList<WCLField>();
    private final List<WCLMethod> methods = new ArrayList<WCLMethod>();
    private final List<WCLInterfaceType> interfaces = new ArrayList<WCLInterfaceType>();

    public WCLInterface(String name, String packageName) {
        this.name = name;
        this.packageName = packageName;
    }

    public String getName() {
        return name;
    }

    public String getPackageName() {
        return packageName;
    }

    public List<WCLAnnotation> getAnnotations() {
        return annotations;
    }

    public WCLAnnotation getAnnotationByName(String name) {

        WCLAnnotation result = null;
        for (WCLAnnotation annotation : annotations) {
            if (annotation.getName().equals(name)) {
                result = annotation;
                break;
            }
        }
        return result;
    }

    public void addAnnotation(WCLAnnotation annotation) {
        annotations.add(annotation);
    }

    public void addField(WCLField field) {
        fields.add(field);
    }

    public List<WCLField> getFields() {
        return fields;
    }

    public void addMethod(WCLMethod method) {
        methods.add(method);
    }

    public List<WCLMethod> getMethods() {
        return methods;
    }

    public void addGenericType(WCLGenericType genericType) {
        genericTypes.add(genericType);
    }

    public List<WCLGenericType> getGenericTypes() {
        return genericTypes;
    }

    public void addImplementedInterface(WCLInterfaceType interfaceType) {
        interfaces.add(interfaceType);
    }

    public List<WCLInterfaceType> getInterfaces() {
        return interfaces;
    }

    public void addImport(WCLImport imprt) {
        imports.add(imprt);
    }

    public List<WCLImport> getImports() {
        return imports;
    }

}
